package com.dhnsoft.tank;

import com.dhnsoft.util.MyUtil;

import java.awt.*;

/**
 * @Description
 * @ClassName MyTank
 * @Author dhn
 * @date 2020.11.18 21:05
 */
//自己的坦克
public class MyTank2 extends Tank{
    //坦克id号
    public int id;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    private static Image[] tankImag;
    private int atkFlag;

    public int getAtkFlag() {
        return atkFlag;
    }

    public int speed;

    public void setAtkFlag(int atkFlag) {
        this.atkFlag = atkFlag;
    }


    static {
        tankImag=new Image[4];
        tankImag[0]= MyUtil.createImage("images/whzU.png");
        tankImag[1]=MyUtil.createImage("images/whzD.png");
        tankImag[2]=MyUtil.createImage("images/whzL.png");
        tankImag[3]=MyUtil.createImage("images/whzR.png");

    }

    @Override
    public void drawTank(Graphics g) {
        g.drawImage(tankImag[getDir()],getX()-RADIUS,getY()-RADIUS,null);
    }

    @Override
    public void fire() {

        if(atkFlag==1){
            super.fire2();
        }
        if(atkFlag==2){
            super.fire3();
        }
        else {
            super.fire();
        }
    }

    public MyTank2(int x, int y, int dir) {
        super(x, y, dir);
    }

}
